import request from '@/utils/request'
import qs from 'qs'
import { get } from 'http';
// 搜索查询作品库
export function searchLibrart(groupId,limit, offset) {
    var  url = '';
    if(groupId == ''){
        url = '/web/video/search?limit=' + limit + '&offset=' + offset;
    }else{
        url = '/web/video/search?groupId= ' + groupId + '&limit=' + limit + '&offset=' + offset;
    }
    return request({
      url: url,
      method: 'get'
    })
  }
//   条件查询搜索
export function contSearch(keyWords,maxTimes,minTimes,limit, offset) {
    var url = '/web/video/search?keyWords= ' + keyWords + '&maxTimes='+maxTimes+'&minTimes='+minTimes+'&limit=' + limit + '&offset=' + offset;
    return request({
        url:url,
        method:'get'
    })
}

//   查询作品库分组信息
export function findGroup(){
    return request({
        url:'/web/video/findGroup',
        method:'get'
    })
}

// 删除抖音作品
export function deleteLibrary(id){
    return request({
        url:"/web/video/delete",
        method:'post',
        data:qs.stringify({
            id:id
        })
    })
}

// 删除作品库分组
export function deleteGroup(groupId) {
    return request({
      url: '/web/video/deleteGroup',
      method: 'post',
      data:qs.stringify({
          groupId:groupId
      })
    })
  }

//   查看作品信息
export function checkInfo(id) {
    return request({
        url:'/web/video/info?id='+id,
        method:'get'
    })
}

// 上传作品接口
export function uploadDevice(data) {
    return request({
        url:'/web/video/uploadVideo',
        method:'post',
        data:qs.stringify(data)
    })
}

// 更新作品接口
export function updateDevice(data) {
    return request({
        url:'/web/video/update',
        method:'post',
        data:data
    })
}